<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<div class="container-breadcrumb">
    <div class="row ">
        <div class="col-sm-12">
            <ol class="breadcrumb">
                <li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
                <li class="active"><s:message text="审核放款"/></li>
            </ol>
        </div>
    </div>
    <!--/.row-->
</div>

<div id="container-content" class="container-content">
    <div class="panel panel-default report-container">
        <div class="panel-heading">
            <div class="col-md-2">审核放款</div>
        </div>
        <div class="panel-body">
            <form:form action="${pageContext.request.contextPath}/checkWithdraw/getList"
                       modelAttribute="customerAttribute" method="get"
                       cssClass="row products-condition" id="myForm">
                <div class="form-inline col-sm-12">
                    <div class="form-group">
                        <label>会员ID&nbsp;</label>
                        <form:input id="id" path="id" cssClass="form-control"/>
                    </div>
                    <div class="form-group">
                        <label>用户名&nbsp;</label>
                        <form:input id="nick" path="telphone" cssClass="form-control"/>
                    </div>

                    <div class="form-group">
                        <label>放款状态</label>
                        <form:select path="checkStatus" cssClass="form-control">
                            <form:option value="" label="请选择"/>
                            <form:option value="1" label="审核中"/>
                            <form:option value="2" label="审核拒绝"/>
                            <form:option value="3" label="审核通过"/>
                            <form:option value="4" label="审核异常"/>
                        </form:select>
                    </div>
                </div>
                <div class="form-inline col-sm-12">
                    <label>发起时间</label>

                    <div class="form-group">
                        <div id="datetimepicker_start" class="input-group date">
                            <form:input id="startTimeDate" cssClass="form-control" path="startTime"
                                        data-date-format="YYYY-MM-DD"/>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                        </div>
                    </div>
                    至
                    <div class="form-group">
                        <div id="datetimepicker_end" class="input-group date">
                            <form:input id="endTimeDate" cssClass="form-control" path="endTime"
                                        data-date-format="YYYY-MM-DD"/>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                        </div>
                    </div>

                    <div class="form-group">
                        <button id="btn_search" type="button" class="btn btn-default">查询</button>
                    </div>
                </div>
                <form:hidden path="currentPage" id="currentPage"/>
                <form:hidden path="pageSize" id="pageSize"/>
                <input id="total" type="hidden" value="${dataList.totalCount}"/>
            </form:form>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>会员ID</th>
                    <th>用户名</th>
                    <th>徒弟数</th>
                    <th>审核状态</th>
                    <th>提现金额</th>
                    <th>发起时间</th>
                    <th>通过时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody id="myTable">
                <c:forEach items="${dataList.data}" var="data">
                    <tr>
                        <td>${data.customerId}</td>
                        <td>${data.telphone}</td>
                        <td>${data.apprenticeNum}</td>
                        <td>${data.checkStatus==1?"审核中":data.checkStatus==2?"审核拒绝":data.checkStatus==3?"审核通过":data.checkStatus==4?"审核异常":"error"}</td>
                        <td>${data.withdrawAccount}</td>
                        <td><fmt:formatDate value="${data.dateCreat}" pattern="yyyy-MM-dd HH:mm"/></td>
                        <td><fmt:formatDate value="${data.completeTime}" pattern="yyyy-MM-dd HH:mm"/></td>
                        <td>
                            <c:if test="${data.checkStatus==1}">
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button"
                                        class="btn btn-success btn-xs check">审核
                                </button>
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button" class="btn btn-warning btn-xs history">查看历史
                                </button>
                            </c:if>
                            <c:if test="${data.checkStatus==2}">
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button"
                                        class="btn btn-danger btn-xs check" disabled>已拒绝
                                </button>
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button" class="btn btn-warning btn-xs history">查看历史
                                </button>
                            </c:if>
                            <c:if test="${data.checkStatus==3}">
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button"
                                        class="btn btn-primary btn-xs check" disabled>已通过
                                </button>
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button" class="btn btn-warning btn-xs history">查看历史
                                </button>
                            </c:if>
                            <c:if test="${data.checkStatus==4}">
                                <button data-id="${data.operationType},${data.customerId},${data.dateCreat},${data.withdrawAccount},${data.checkStatus}"
                                        type="button"
                                        class="btn btn-danger btn-xs check" disabled>出现异常
                                </button>
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <div class="row">
                <div id="paginationInfo" class="col-md-4 pagination-info"></div>
                <div id="pagination" class="col-md-8"></div>
            </div>
        </div>
    </div>
</div>

<script src="${pageContext.request.contextPath}/resources/common/js/bootstrap-paginator.js"></script>
<script src="${pageContext.request.contextPath}/resources/js/common/paginator.js"></script>
<script>
    var flag = "show";
    $(document).ready(function () {

        //审核出错会提示
        var message = '${message}';
        if ( message!='null'&&message != '') {
            alert(message);
        }

        $('#datetimepicker_start').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            language: 'zh', //汉化
            pickTime: false,
            autoclose: true
        });
        $('#datetimepicker_end').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            language: 'zh', //汉化
            pickTime: false,
            autoclose: true
        });

        $("#btn_search").click(function () {
            $("#currentPage").val("1");
            $("#myForm").submit();
        });

        $(".check").click(function () {
            var id = $(this).data("id");
            window.location.href = "${pageContext.request.contextPath}/checkWithdraw/checkWithdraw?ids=" + id;
        });
        $(".history").click(function () {
            var id = $(this).data("id");
            window.location.href = "${pageContext.request.contextPath}/checkWithdraw/checkWithdraw?ids=" + id;
        });
    });
</script>


